
/**    
 * <p>Copyright： 东软烟草产品研发团队</p>   
 */

package com.jkl.service.notice;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.jkl.dao.notice.PnNoticeMapper;
import com.jkl.entity.notice.PnNotice;
import com.jkl.entity.project.po.PJProjectPicture;
import com.jkl.service.notice.inter.PnNoticeServiceInterface;
import com.jkl.service.project.inter.IPJProjectPictureService;

import lombok.extern.slf4j.Slf4j;

/**
 * <p>
 * 123service
 * <p>
 * <p>
 * 123service
 * <p>
 * <p>
 * 变更说明：ji.k 2018年1月17日 123service
 * <p>
 * Date:2018年11月18日
 * 
 * @author ji.k
 * @version 1.0
 */
@Service
@Slf4j
public class PnNoticeService implements PnNoticeServiceInterface {

	@Autowired
	private PnNoticeMapper pnNoticeMapper;
	@Autowired
	private IPJProjectPictureService pjProjectPictureService;

	@Override
	public void addNotice(PnNotice noticeInfo, List<MultipartFile> fileList) {
		pnNoticeMapper.addNotice(noticeInfo);
		Integer projectId = noticeInfo.getRowId();
		pjProjectPictureService.addProjectPicture(3, projectId, fileList);
	}

//	@Override
//	public List<PnNotice> queryPnNoticeList(PnNotice pnNotice) {
//		return pnNoticeMapper.selectByEntity(pnNotice);
//	}

	@Override
	public PageInfo<PnNotice> queryPnNoticeList(PnNotice param) {
		PageHelper.startPage(param.getCurrentPage(), param.getPageSize());
		List<PnNotice> list = pnNoticeMapper.selectByEntity(param);
		PageInfo<PnNotice> pageInfo = new PageInfo<>(list);
		return pageInfo;
	}

	@Override
	public PnNotice queryPnNoticeDetail(String rowId) {
		PnNotice notice = pnNoticeMapper.queryPnNoticeDetail(rowId);
		PJProjectPicture queryRecord = new PJProjectPicture();
		queryRecord.setRecordId(Integer.parseInt(rowId));
		queryRecord.setPicType(3);
		List<PJProjectPicture> picList = pjProjectPictureService.getMapper().select(queryRecord);
		notice.setPictureList(picList);
		return notice;
	}

	@Override
	public int queryCount(PnNotice pnNotice) {
		return pnNoticeMapper.queryCount(pnNotice);
	}

	@Override
	public PnNotice noticeObject(String rowId) {
		return pnNoticeMapper.noticeObject(rowId);
	}

	@Override
	public int updateNotice(PnNotice param) {
		return pnNoticeMapper.updateNotice(param);
	}

	@Override
	public int deleteNotice(String rowId) {
		return pnNoticeMapper.deleteNotice(rowId);
	}

	@Override
	public List<PnNotice> selectFive(String type) {
		return pnNoticeMapper.selectFive(type);
	}
	@Override
	public PnNotice queryNotice(Integer rowId) {
		return pnNoticeMapper.queryNotice(rowId);
	}
	@Override
	public void insertNotice(PnNotice noticeInfo) {
		pnNoticeMapper.insertNotice(noticeInfo);
	}
	@Override
	public int updateNoticeBySuper(PnNotice param) {
	
		return pnNoticeMapper.updateNoticeBySuper(param);
	}
	@Override
	public PJProjectPicture queryProjectPicture(Integer rowId) {
		return pnNoticeMapper.queryProjectPicture(rowId);
	}
	@Override
	public void insertProjectPicture(PJProjectPicture projectPicture) {
		pnNoticeMapper.insertProjectPicture(projectPicture);
	}
	@Override
	public int updateProjectPicture(PJProjectPicture projectPicture) {
	
		return pnNoticeMapper.updateProjectPicture(projectPicture);
	}
}